package com.supersit.GZFDA.adapter;

import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

/**
 * 没有用到
 * 
 * @author Administrator
 * 
 */
public class AutoCompleteTextViewAdapter extends CursorAdapter {
	private int columnIndex;

	public AutoCompleteTextViewAdapter(Context context, Cursor c, int col) {
		super(context, c);
		this.columnIndex = col;
	}

	@Override
	public View newView(Context context, Cursor cursor, ViewGroup parent) {
		final LayoutInflater inflater = LayoutInflater.from(context);
		final TextView view = (TextView) inflater.inflate(
				android.R.layout.simple_dropdown_item_1line, parent, false);
		view.setText(cursor.getString(columnIndex));
		return view;
	}

	@Override
	public void bindView(View view, Context context, Cursor cursor) {
		((TextView) view).setText(cursor.getString(columnIndex));
	}

	@Override
	public String convertToString(Cursor cursor) {
		return cursor.getString(columnIndex);
	}

	// @Override
	// public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
	// if (constraint != null) {
	// String selection = "business_name like \'%"
	// + constraint.toString() + "%\'";
	// //return db.query("gzfad_data", columns, selection, null, null,
	// null, null);
	// } else {
	// return null;
	// }
	// }

}
